package com.example.qgpayconsumer.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016101800713737";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCrEA2uN6BuUf9SGvdzJeJfEUn4+CcN4XmxTSuqzPwYT9FKd7mn7U8N8mAxvaMiMnefAHhk2Nojn46BgJq7nZU15LvWpLUJTAKiI5qQcGjV9HKWeXgDL2aFkRATygcq87mnMzfzo+vlMVIahKFHBxPj+mUFCV9dHt3iKhFMS1nSjWNsAGie1wFnl17z/0ELBAgzCmtlKxKR/FRbdDhSY1FaYnhnmXfTEXs0klYDI4XAGAKPn3AMeAxw68m7nZKI++fI/nEbHs7EeEHLRfNCeK6mH4E/x5dcN5G0LsNCfj8irYjdnK9A0TQ0hndCWKvh5IYDEqpvn8Ctainn3Pri9BxhAgMBAAECggEAZeirbcW/8tkwtTZRgqzoHmDLY+JaSd+wwtrJj/iMmuM6ORX4ab1rolBp1Fg4jo/oSbZbAyFZW22b1TTLecgYc0HwUaBQJdi9nOB/HVuKaSQ2+8Qjpiof9qSEInXyLTmDucM+qwxV5XWrhxbKiekChYfPlN+Pi4dvAmSzZ3NgcJlHYBKnERsUQh+X9UhdEIWfU/vgLFWQvv9Z6DkSoFLbSeUc8TeQL5YXWeHY7BMMsaxMNv1scFm3wZX8JUn2usXATFmfMJl+ltDtgTaO/09NYdn5S3E4fvMwqH+fFf4A0eBTYs9KbKt0wvOTXkbQ25gR45K3yLbRhGi6U2IQ1cgrvQKBgQDWQuYe4UQM8CFzVee0LNICWrXUYap1r/+dcNvYFAgxP3vDc6bld46vLaLfgMWdow2okeb8dX1dLM07wRovzs/hno43yTgvJEPOWydtGK5qtfI7uVW6ms/jS5DzkL+GMTZ6VBe1pofMvcMy6aAkRI9Px3oZ/ba9PJSWyFvPp3TaowKBgQDMYtysFQP63WUOObyoF8RNFNy1pWFUVyNf3RM4T0NR5/pW1VmQfoyN1CoLFqhBsE7QBPznCBPlJgMLMYFH4OnTT1xTqfs+YPeOHfEH9saRv2KDLuuVo3Y6HIdWSi9nTewuNLwQd319N4oHqeZ3YIgM+QUhbywK93BP5QwnSvBBKwKBgCETYLzhn4SzySYp28P3q0/LuwgXL55NVhNy6a04om8f0rZAc0I3K6KlU+BW26rTEfe01kigxoKMuP4BeE5rCbJVrLS17mNwoLsJXVO9HKfCgKtxl+dfoLoA31aKQNaxYCyQMLzNAWe835ZLdHpEzy7Mp2+9t+kMog+IzIuI2UQrAoGBAJse/XTtjlO77JLbZz/8qdQG3WxP1Ir6h7KeS5QVNHbZpbp5urxcD7klKbO4woL4mRhwcLG4A8GLFAxOylwPa+gg92XYQQOa/Mg0GVd+CD9eDhqaZdrwcS6xsFXhgBDbp0F6bLHivq9mk7A1VuGLtjaCWU6C3d6E5gz9PjgkPCx5AoGAOtt6USlGjHUTq2Hj+548GCp+iPYFZextm+yUO+KreTlXvS5OPfN2e57Vp9YjuQjD8fm30xirSc0D+xgdc6B4Ag7132VtrfsfIOr10InuCwhTZ98DGUYhBpmGH8DkGqTBIF1a60eZkK7A5NXakuysGOf320TDEEQf8htMj3g3r1M=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhyS1+VM89DQYpsfJXZatDn7QEBZVRg0FCwajbUWrOjjAesQrDQlYYZmDkgNxRE9LGggQn3R86oDZmCmQEz7NkyuK95MKKdFSaz04BwzD/ADS3iaoeF/qikTYMoBpiqXOg2HcxTpam8CZ6GqsmZb7LncVTlhichxU32wnC5RoivOx1Np2SJ5McquIg+4uN4L/3x7021je0wNisij0MpddGEq02r9SpHz4m4E8oaQmXhgEU/o2xKPxcLbkSIVqaOAMTypr+39YPV/d745wCmrSxq6+1qovlvx6dEjS44WlTnHL3eAsWl/+q8udM42ichlaCLWQX84i9j2na06Vhj+3FQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
//	public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";
    public static String return_url = "http://192.168.182.128:8030/addTrade";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl ="https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

